package com.api.aron.intercept.impl;

import com.alibaba.fastjson.JSONObject;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

/**
 * 修改人员
 * @author YDH
 * CreateTime 2020年9月28日 下午10:08:34
 */
@WeaIocReplaceComponent
public class HrmInfoEditAction extends BaseBean{
    @WeaReplaceAfter(value = "/api/hrm/resource/editResource", order = 1)
    public String after(WeaAfterReplaceParam weaAfterReplaceParam) {
        RecordSet rs = new RecordSet();
        JSONObject json = JSONObject.parseObject(weaAfterReplaceParam.getData());
        Map params = weaAfterReplaceParam.getParamMap();
        String departmentId = params.get("departmentid").toString();
        System.out.println(departmentId);
        writeLog(params.toString());
        User user = HrmUserVarify.getUser(weaAfterReplaceParam.getRequest(), weaAfterReplaceParam.getResponse());
//        if ("on".equals(Util.null2String(params.get("type")))
//                && Util.null2String(json.get("signtime")).compareTo("12:01:00") > 0) {
//            int userId = user.getUID();
//            String signTime = "12:00:45";
//            String belongdate = Util.null2String(params.get("belongdate"));
//            String sql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr)  select top 1 userId,userType,2,signDate,'"
//                    + signTime
//                    + "',clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr from HrmScheduleSign where userid = "
//                    + userId + " and  belongdate = '" + belongdate + "' order by id desc ";
//            rs.executeUpdate(sql);
//            sql = "insert into hrmschedulesign_remind(userid,signtype,signdate,signtime,belongdate)values(?,?,?,?,?)";
//            rs.executeQuery(sql, userId, 2, belongdate, signTime, belongdate);
//        }
        return weaAfterReplaceParam.getData();
    }
}